<?php

$api = app('Dingo\Api\Routing\Router');
$moduleName = 'UI';

// 平台后台api
$api->version('v1', ['prefix' => 'admin-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Admin\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'] ;

	$api->post('/setting/ui/{type}', ['uses'=> "UISettingController@store"]);
	$api->get('/setting/ui/{type}', ['uses'=> "UISettingController@show"]);

	$api->get('/paths', ['uses'=> "PathController@index"]);

	$api->resource('danmus', "DanmuController", ['only' => $allMethod]);

	$api->get('/status-total/danmu', ['uses'=> "DanmuController@statusTotal"]);

	$api->post('/danmu/import/preview', ['uses'=> "DanmuController@importFile"]);
	$api->post('/danmu/import/confirm', ['uses'=> "DanmuController@importConfirm"]);
});

// 租户api
$api->version('v1', ['prefix' => 'tenant-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Tenant\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];
});

// 普通用户api
$api->version('v1', ['namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Client\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];

	$api->get('/activity-home', ['uses'=> "ActivityHomeController@show"]);
	$api->get('/setting/{type}', ['uses'=> "SettingController@show"]);

	$api->get('/danmus/{type}', ['uses'=> "DanmuController@show"]);

	$api->get('/shareApp', ['uses'=> "UIController@shareApp"]);

    $api->get('/getFudaiRule/{id}', ['uses'=> "SettingController@getFudaiRule"]);

	// 搜索
	$api->post('/search', ['uses'=> "SearchController@store"]);
});